home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BMUG Revelations
/
BMUG Revelations.toast
/
Utilities
/
Catalogers
/
Catalog +2.0
/
Read Me
< prev
Wrap
Text File
|
1989-07-15
|
4KB
|
98 lines
Catalog+ 2.0
by
Charles Bess
written in Lightspeed C
Overview
Catalog+ is a utility for viewing information about files. It has one
feature that I have not found on any other directory program for the
Macintosh. It utilizes regular expressions. Regular expressions allow
the user to develop complex statements for matching patterns.
Regular expressions are common in UNIX tools. They will be
explained in more detail later. I have also implemented regular
expressions for searching file types and owner applications.
File specification
Files can be specified by the standard Macintosh convention:
Volume name: (folder name:) (...:) file name
Since this is a a directory program I have added the capability of
running through child directories by using three periods followed by
a colon. The Volume name and any folder names you supply have to
be spelled correctly and in the correct case (i.e. dog is not equal to
Dog). An example of running through an entire volume (Dog) looking
for files that begin with a would be:
Dog:...:^[Aa]
Options
There are many display options available from this program. It will
display the files owner application type ... The different output
columns are separated by spaces if the output is sent to a printer or
the screen. When the output is sent to a file it is separated by tabs. It
should be suitable for loading into a database program for sorting
etc.
Regular Expressions
Regular expressions are used for matching patterns of text. The
following text explains the major regular expression special
characters.
$
The dollar sign in a regular expression stands for the end of the
string. If you were trying to match a file that ended in ing your
regular expression should be:
ing$.
^
The hat stands for the beginning of a string. If you were trying to
match a file that starts with micro the regular expression should be:
^micro.
*
The star means zero or more multiples of a previous pattern. For
example if you would like to match zero or more multiples of an a
with a b before it your expression would be:
ba*.
+
The plus means one or more multiples of a previous pattern. For
example if you would like to match an a with a b before it your
expression would be: ba*.
.
Period is a place holder that stands for any letter. If you were trying
to match a string that had an a separated from a c by one letter the
pattern would be:
a.c.
[]
The brackets are used to make special matching sequences. If you
were trying to match a A and an a the pattern would be:
[Aa]
There is also a way to specify that you do not want it to be an A or a.
The hat (^) is used to mean not the following. For example if we
wanted all the files that did not start with a the expression would be:
^[^Aa]
Another type of sequence can contain a group of letters. The dash (-)
is used to specify a range of letters. For example if I wanted all the
files that begin with a lower case letter I would use the expression:
^[a-z]
\
This letter has special meaning when you need to use one of the
previous characters or a number. Otherwise it means take the next
character literally. For example if you wanted to look through the
system for files that end with .c or .C the expression would be:
\.[Cc]$
?
The question mark means zero or 1 match of a previous pattern. For
example if you would like to match zero or more multiples of an a
with a b before it your expression would be:
ba*.
examples
.* matches anything
a*b matches zero or more a's followed by a b
(abcdef, b,aaaaaaab)
[0-9] matches any integer
[0-9.Ee+-] matches any real